Skip to content

feat: controller support#39

Merged
bitsandfoxes merged 7 commits intomainfrom
joshua/fix/ps5_controller_support
Feb 16, 2026
Merged

feat: controller support#39
bitsandfoxes merged 7 commits intomainfrom
joshua/fix/ps5_controller_support

Conversation

@JoshuaMoelans
Copy link
Member

@JoshuaMoelans JoshuaMoelans commented Jan 30, 2026

Adds support for controllers:

  • UI navigation on upgrade
  • pause screen access + navigation
  • aim marker arrow (like on mobile)

Also fixes the following:

  • (keyboard) navigate (movement keys) + choose upgrade (spacebar)
  • pause-in-upgrade bug (would lead to a limbo state)

TODO

  • test on PlayStation controller
  • test on Xbox controller
  • test on Switch controller

@JoshuaMoelans JoshuaMoelans marked this pull request as ready for review February 3, 2026 16:46
@JoshuaMoelans
Copy link
Member Author

@sentry review

Comment on lines +16 to +20
bool shouldShowArrow = Application.platform == RuntimePlatform.Android ||
Application.platform == RuntimePlatform.IPhonePlayer ||
Gamepad.current != null;

gameObject.SetActive(shouldShowArrow);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: The arrow's visibility is set once in Awake() based on gamepad presence and never updates, causing the UI to be missing if a controller is connected mid-game.
Severity: MEDIUM

Suggested Fix

To ensure the arrow's visibility reflects the current input device, subscribe to the InputSystem.onDeviceChange event. In the event handler, check for gamepad presence and update the arrow's active state accordingly. Remember to unsubscribe from the event in OnDestroy() to prevent memory leaks. Alternatively, move the check into the Update() method for continuous polling.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.

Location: Assets/Scripts/Characters/Arrow.cs#L16-L20

Potential issue: The arrow's visibility is determined by checking `Gamepad.current !=
null` only once within the `Awake()` method and is never updated again. If a player
connects a gamepad after the scene has loaded, the arrow UI indicator will remain
hidden, even though other game systems correctly switch to gamepad input. This creates
an inconsistent user experience where the aiming system recognizes the controller, but
the associated visual aid does not appear.

Did we get this right? 👍 / 👎 to inform future reviews.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

true, also thought about this while adding the one-time-check; but since we're gonna run the demo on handheld consoles, if the controller disconnects that must mean the console itself was destroyed.. IMO this is not something we need to fix right away, but can be opened as a new issue to show we're aware of this.

Copy link
Contributor

@bitsandfoxes bitsandfoxes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot! :shipit:

@bitsandfoxes bitsandfoxes merged commit 67f904c into main Feb 16, 2026
4 checks passed
@JoshuaMoelans JoshuaMoelans deleted the joshua/fix/ps5_controller_support branch February 16, 2026 15:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants